package com.cheng.tetris;


//本游戏采用相对坐标，将游戏区域的一部分表示成相对坐标
public class Rectangle
{
    private int absX = -30;
    private int absY = -30;
    private int X;
    private int Y;

    public Rectangle() {}

    public Rectangle(int x, int y)
    {
        setX(x);
        setY(y);
    }

    public int getAbsX()
    {
        return absX;
    }

    public int getAbsY()
    {
        return absY;
    }

    public int getX()
    {
        return X;
    }

    public void setX(int x)
    {
        X = x;
        absX = 20*(x - 1);
    }

    public int getY()
    {
        return Y;
    }

    public void setY(int y)
    {
        Y = y;
        absY = 20*(y - 1);
    }

    public void setXY(int x, int y)
    {
        setX(x);
        setY(y);
    }

    @Override
    public String toString()
    {
        return X + ", " + Y + "\n";
    }
}
